<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => {
  assert_selection(
    '<div contenteditable>^<img src="../resources/abe.png">|</div>',
    selection => {
      let doc = selection.document;
      doc.execCommand('Copy');
      doc.execCommand('Paste');
      doc.execCommand('Paste');
      // Note: Chnage IMG/@SRC to relative URL, since copyed HTML has absolute
      // URL which depends on test environment.
      doc.querySelectorAll('img').forEach(img => {
        assert_not_equals(img.src.match(/abe[.]png$/), null);
        img.src = '../resources/abe.png';
      });
    },
    '<div contenteditable><img src="../resources/abe.png"><img src="../resources/abe.png">|</div>');
}, 'Page image twice');
</script>
